package com.train.order.facade.admin;

import cn.hutool.core.bean.BeanUtil;
import com.train.common.resp.CommonResp;
import com.train.common.resp.PageResp;
import com.train.order.dto.confirm.ConfirmOrderPageDTO;
import com.train.order.req.confirm.ConfirmOrderPageReq;
import com.train.order.resp.ConfirmOrderPageResp;
import com.train.order.service.ConfirmOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * confirmOrder Facade 接口
 * @author baitiaojun
 * @createDate 2025-03-11 21:07:57
 */
@RestController("adminConfirmOrderFacade")
@RequiredArgsConstructor
@RequestMapping("/admin/confirm-order")
public class ConfirmOrderFacade {

    private final ConfirmOrderService confirmOrderService;

    @PostMapping("page")
    public CommonResp pageList(@RequestBody @Validated ConfirmOrderPageReq req) {
        ConfirmOrderPageDTO confirmOrderPageDTO = BeanUtil.copyProperties(req, ConfirmOrderPageDTO.class);
        PageResp<ConfirmOrderPageResp> pageResp = confirmOrderService.pageList(confirmOrderPageDTO);
        return CommonResp.ok(pageResp);
    }
}
